_Pragma("once")

#include <memory>
#include <unistd.h>

#include "BasicDevice.h"
#include "Utility.h"
#include "Log.h"

class DeviceCommunicator : public BasicDevice {
public:
    using BasicDevice::BasicDevice;
//    DeviceCommunicator(const int& deviceName){
//    }

    virtual ~DeviceCommunicator(){
    }

    virtual ssize_t write(const std::string& exceptionTip, void const * const data, const size_t size) noexcept{
        return ::write(deviceFd, data, size);
    }

    virtual ssize_t read(const std::string& exceptionTip, void * buffer, const size_t length) noexcept{
        return ::read(deviceFd, buffer, length);
    }

    uint8_t mbuffer[STRING_BUFFER_SIZE];
};



using DeviceCommunicatorPtr = std::shared_ptr<DeviceCommunicator>;
